package spill;

import java.awt.Graphics;

public class Student implements Drawable {
	private Item animation[];
	private int num;
	private int x;
	private int y;
	private Engine engine;
	private boolean inUse;
	
	public Student(Engine engine) {
		animation = new Item[4];
		animation[0] = new Item("Graphics/Student0C.txt", "Graphics/Student0D.txt", engine);
		animation[1] = new Item("Graphics/Student1C.txt", "Graphics/Student1D.txt", engine);
		animation[2] = new Item("Graphics/Student2C.txt", "Graphics/Student2D.txt", engine);
		animation[3] = new Item("Graphics/Student3C.txt", "Graphics/Student3D.txt", engine);
		num = 0;
		inUse = false;
		reset();
		this.engine = engine;
	}
	
	public void draw(Graphics g) {
		num = (int)(engine.getTime()%40)/10;
		animation[num].setCoord(x, y);
		animation[num].draw(g);
	}
	
	public void move() {
		x = x+1;
		if (x > 1000) {
			inUse = false;
			engine.remove(this);
		}
	}
	public int getX() {
		return x;
	}
	public int getY() {
		return y;
	}
	public void setCoord(int x, int y) {
		this.x = x;
		this.y = y;
	}
	public void reset() {
		x = 0;
		y = 470;
		inUse = true;
	}
	public boolean isInUse() {
		return inUse;
	}
	public void setInUse(boolean state) {
		inUse = state;
	}
}
